home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
doom
/
turric03.zip
/
TURRIC03.ZIP
/
PROGS
/
CORPSE.QC
< prev
next >
Wrap
Text File
|
1997-02-06
|
5KB
|
184 lines
/*
==============================================================================
CORPSES
==============================================================================
File was created by Turrican to hold all corpse related functions while
working on additions to Jason Carter's gibbin3 patch.
*/
// prototypes
void(string gibname, float dm) ThrowGib;
void(string gibname, float dm) ThrowHead;
// Thanks to Michael Gummelt <gummelt@pegasus.montclair.edu> for helping
// me with this \/.
void () WalkOnCorpse =
{
if (other == world ||
other.classname == "grenade" ||
other.classname == "missile")
{
return;
}
other.flags = other.flags | FL_ONGROUND;
if (self.classname == "gib")
{
EatGibs();
}
else if (self.classname == "gib_head" ||
self.classname == "player_head")
{
EatHead();
}
};
// Has size and head gib model parameters passed as globals in
// .corpse_size and .head_gib_model, which are set at the start of a monster's
// _die function.
void () Corpse_die =
{
local float i; // loop counter.
self.deadflag = DEAD_DEAD;
if ((time >= (self.corpse_time + 0.5)) && (self.corpse_time != 0))
{
sound (self, CHAN_VOICE, "player/tornoff2.wav", 1, ATTN_NONE);
if (damage_attacker.classname == "teledeath" ||
damage_attacker.classname == "teledeath2")
return;
}
else
{
if (damage_attacker.classname == "teledeath")
{
sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
return;
}
if (damage_attacker.classname == "teledeath2")
{
sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
return;
}
if (random() < 0.5)
sound (self, CHAN_VOICE, "player/gib.wav", 1, ATTN_NONE);
else
sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NONE);
}
ThrowHead (self.head_gib_name, self.health);
i = 0;
while (i <= self.corpse_size)
{
ThrowGib ("progs/gib1.mdl", self.health * self.corpse_size);
ThrowGib ("progs/gib2.mdl", self.health * self.corpse_size);
ThrowGib ("progs/gib3.mdl", self.health * self.corpse_size);
ThrowGib ("progs/gib3.mdl", self.health * self.corpse_size);
i = i + 1;
}
};
void () Head_die =
{
//** PATCH_BEGIN - temporary entity limiting - Turrican ****
// To prevent packet overflows from too many gibs being created.
if (current_temp_entities < MAX_TEMP_ENTITIES)
{
ThrowGib ("progs/gib1.mdl", self.health * 3);
ThrowGib ("progs/gib1.mdl", self.health * 3);
ThrowGib ("progs/zom_gib.mdl", self.health * 3);
ThrowGib ("progs/zom_gib.mdl", self.health * 3);
ThrowGib ("progs/zom_gib.mdl", self.health * 3);
ThrowGib ("progs/zom_gib.mdl", self.health * 3);
}
SUB_RemoveTempEnt();
//** PATCH_END - temporary entity limiting - Turrican ******
};
void () MakeGibSolid =
{
self.solid = SOLID_SLIDEBOX;
setsize (self, '-5 -5 0', '5 5 10');
self.takedamage = DAMAGE_YES;
self.health = GIB_HEALTH;
self.classname = "gib";
self.touch = WalkOnCorpse;
self.nextthink = time + 10 + random()*10;
//** PATCH_BEGIN - temporary entity limiting - Turrican ****
self.think = SUB_RemoveTempEnt;
self.th_die = SUB_RemoveTempEnt;
//** PATCH_END - temporary entity limiting - Turrican ******
};
void (float corpse_health, vector size_min, vector size_max) MakeCorpse =
{
self.health = corpse_health;
setsize (self, size_min, size_max);
self.th_stand = SUB_Null;
self.th_walk = SUB_Null;
self.th_run = SUB_Null;
self.th_pain = SUB_Gib;
self.th_melee = SUB_Null;
self.th_missile = SUB_Null;
self.takedamage= DAMAGE_YES; // DAMAGE_AIM ?
self.flags = self.flags &! FL_MONSTER;
self.classname = "corpse";
self.th_die = Corpse_die;
self.corpse_time = time;
// Thanks to Michael Gummelt <gummelt@pegasus.montclair.edu> for helping
// me with this \/.
self.touch = WalkOnCorpse;
};
void (float corpse_health, vector size_min, vector size_max) MakePlayerCorpse =
{
local entity corpse;
// Create a corpse
corpse = spawn();
corpse.solid = self.solid;
corpse.movetype = self.movetype;
corpse.origin = self.origin;
corpse.angles = self.angles;
setmodel(corpse, self.model);
corpse.colormap = self.colormap;
corpse.skin = self.skin;
setsize (corpse, size_min, size_max);
corpse.modelindex = self.modelindex;
corpse.frame = self.frame;
corpse.velocity = self.velocity;
corpse.avelocity = self.avelocity;
corpse.health = corpse_health;
corpse.th_pain = SUB_Gib;
corpse.takedamage= DAMAGE_YES; // DAMAGE_AIM ?
corpse.classname = "corpse";
corpse.th_die = Corpse_die;
corpse.head_gib_name = self.head_gib_name;
corpse.corpse_size = self.corpse_size;
corpse.corpse_time = time;
// Thanks to Michael Gummelt <gummelt@pegasus.montclair.edu> for helping
// me with this \/.
corpse.touch = WalkOnCorpse;
// Alter self.
setmodel(self, "");
setsize (self, VEC_ORIGIN, VEC_ORIGIN);
self.solid = SOLID_NOT;
self.touch = SUB_Null;
self.takedamage = DAMAGE_NO;
self.view_ofs = '40 0 -20';
};